package struts.core;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRequestEvent;
import javax.servlet.http.HttpServlet;

import struts.core.util.StrutsXmlUtil;

public class ActionServletListenter implements ServletContextListener {

	public ActionServletListenter() {
	}

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		System.out.println("系统已经销毁！");
	}

	@Override
	public void contextInitialized(ServletContextEvent servletcon) {
		ServletContext context = servletcon.getServletContext();
		String xmlPath = context.getInitParameter("struts-config");
		String tomcatPath = context.getRealPath("\\");
		try{
		context.setAttribute("struts", StrutsXmlUtil.strtus_xml(tomcatPath+xmlPath));
		}catch(Exception e){
			e.printStackTrace();
		}
	}

 
}
